﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CreatPasswords
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

      
        private string CreatPassword(int num)
        {
            string strPassword = "";
            string str = @"qwertyuiopasdfghjklzxcvbnm
                           QWERTYUIOPASDFGHJKLZXCVBNM
                           1234567890
                           .+-*/,<>?;[]{}\!@#$%^&()=";
            Random random = new Random();
            for(int i = 0; i<num; i++)
            {
                strPassword += str[random.Next(str.Length)];
            }
            return strPassword;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CreatPassword(8);
        }

        private void Btn8Char_Click(object sender, EventArgs e)
        {
            TBoxPasswd.Text =  CreatPassword(8);
        }

        private void Btn12Char_Click(object sender, EventArgs e)
        {
            TBoxPasswd.Text = CreatPassword(12);
        }

        private void Btn16Char_Click(object sender, EventArgs e)
        {
            TBoxPasswd.Text = CreatPassword(16);
        }
    }
}
